﻿#ifndef TIMERWIDGET_H
#define TIMERWIDGET_H

#include <QWidget>
#include <QVBoxLayout>
#include <QHBoxLayout>
#include <QStackedWidget>
#include <QPushButton>
#include <QLabel>
#include <QButtonGroup>
#include "CountDownWidget.h"
#include "TheTimingWidget.h"
#include "MagnifyTimerWidget.h"

class TimerWidget : public QWidget
{
    Q_OBJECT
public:
    explicit TimerWidget(QWidget *parent = nullptr);
    ~TimerWidget();

public:


private:
    enum STATES {
        COUNTDOWN = 0,
        THETIMER
    };


    void InitUi( void );
    void InitProperty( void );

    void SetResetButtonState(QString state);
    void SetSwitchButtonState(QString state);
    void SetAmplificationButtonState(QString state);

    // 是否启动Timer
    void State(bool state, bool pause = false);

signals:
    void closeed();

protected:
    void mousePressEvent(QMouseEvent *event);
    void mouseReleaseEvent(QMouseEvent *event);
    void mouseMoveEvent(QMouseEvent *event);


private:
    QWidget *m_pParent;

    QPoint m_pPoint;
    bool m_bMouseLeftButton;

    bool m_bPause;
    bool m_bStart;

    QVBoxLayout *m_pRootLayout;
    QWidget *m_pRootWidget;
    QVBoxLayout *m_pRootWidgetLayout;

    // 顶部布局
    QWidget *m_pTopWidget;
    QHBoxLayout *m_pTopWidgetLayout;
    QLabel *m_pTopLabel;
    QButtonGroup *m_pButtonGroup;
    QPushButton *m_pCountDownButton;
    QPushButton *m_pTheTimingButton;
    QPushButton *m_pCloseButton;

    MagnifyTimerWidget *m_pMagnifyTimerWidget;

    // 功能布局
    QStackedWidget *m_pStackedWidget;

    CountDownWidget *m_pCountDownWidget;

    TheTimingWidget *m_pTheTimingWidget;

    // 底部布局
    QWidget *m_pBottomWidget;
    QHBoxLayout *m_pBottomWidgetLayout;
    QPushButton *m_pResetButton;
    QPushButton *m_pSwitchButton;
    QPushButton *m_pAmplificationButton;

    STATES m_sState;

};

#endif // TIMERWIDGET_H
